<template>
	<sc-drawer
		v-model="visible"
		title="添加套餐"
		size="700px"
		@cancel="$emit('close')"
		@confirm="confirm"
	>
		<StudentInfoForm v-model:studentInfo="studentInfo" ref="studentInfoFormRef"/>
	</sc-drawer>
</template>

<script setup>
import { ref, getCurrentInstance } from "vue";
import { ElMessage } from 'element-plus';
import StudentInfoForm from "@/views/teach/package/package-form/index.vue";

const studentInfoFormRef = ref(null)
const { proxy } = getCurrentInstance();
const visible = ref(true);
const studentInfo = ref({})

function confirm() {
  studentInfoFormRef.value.validate({
    success() {
      visible.value = false
      proxy.$API.teaching.setMenu.post(studentInfo.value).then(res => {
        console.log('proxy.$API.student.add -> res', res)
      })
    },
    error() {
      ElMessage({
        message: '请完善表单必填项',
        type: 'error',
      })
    }
  })
}
</script>

<style lang="scss" scoped>
.mr10 {
	margin-right: 10px;
}
</style>
